<form action="advertisement.manage.php?action=update" method="post" enctype="multipart/form-data" id="form_add" name="form_add" style="padding-bottom:20px" >
	<table class="from_table">
  		<tr>
			<th class="th2"><tpl> $langOtherTransferCode </tpl>：</th>
			<td width="530" class="td1"><input name='txt_code' type='text' id="txt_code" 
class="txtinput" value="<tpl> $adv_array.adv_code </tpl>" /></td>
		</tr>
		<tr>
			<th class="th2"><tpl> $langOtherTitle </tpl>：</td>
			<td width="530" class="td1"><input name='txt_title' type='text' id="txt_title" 
class="txtinput" value="<tpl> $adv_array.adv_title </tpl>" />
			<label style="display:none" for="txt_title" class="wrong" metaDone="true" generated="true"></label>			</td>
		</tr>
		<tr>
			<th class="th2"><tpl> $langOtherAddType </tpl>：</td>
			<td width="530" class="td1"><tpl> $txt_type </tpl></td>
		</tr>
		<tr>
			<th class="th2"><tpl> $langOtherImage </tpl>：</td>
			<td width="530" class="td1">
				<tpl> if $adv_array.adv_pic neq '' </tpl>
					<img src="<tpl> $site_url </tpl>/<tpl> $adv_array.adv_pic </tpl>" width='100px;' heigth='100px;' border="0" style="vertical-align:middle; margin-left:10px;margin-right:10px" />
					 <span class="btn_left">
					<input style=" font:12px/1.2em '宋体'"type="button" id="delbutton" class="btn_submit" name="delbutton" value="<tpl> $langOtherAdvDel </tpl>" />
					</span>
				<tpl> else </tpl>
					<input name="txt_pic" id="txt_pic" type="file" />
				<tpl> /if </tpl>			</td>
		</tr>
		<tr>
			<th class="th2"><tpl> $langOtherLink </tpl>：</td>
			<td width="530" class="td1"><input name='txt_url' type='text' id="txt_url" 
class="txtinput" value="<tpl> $adv_array.adv_url </tpl>" />
			<label style="display:none" for="txt_url" class="wrong" metaDone="true" generated="true"></label>			</td>
		</tr>
		<tr>
			<th class="th2"><tpl> $langOtherDisTime </tpl>：</td>
			<td width="530" class="td1">
			<input type="text" name="txt_start_date" id="s_date" style="border:solid 1px #B0DF82;cursor:pointer; width:100px; background:url(../js/calendar/blue/cal_btn.gif) no-repeat right; height:18px; padding-right:19px;" readonly="readonly" value="<tpl> $adv_array.adv_start_date </tpl>" /> <tpl> $langOtherTo </tpl>
  	    	<input type="text" name="txt_end_date" id="e_date" style="border:solid 1px #B0DF82;cursor:pointer; width:100px; background:url(../js/calendar/blue/cal_btn.gif) no-repeat right; height:18px; padding-right:19px; " readonly="readonly" value="<tpl> $adv_array.adv_end_date </tpl>" />			</td>
		</tr>
		<tr>
			<th class="th2"><tpl> $langOtherAdvBulk </tpl>：</td>
			<td width="530" class="td1"><tpl> $langOtherWidth </tpl>：<input type="text" name="txt_width"  id="txt_width" class="txtinput_short" size="6" value="<tpl> $adv_array.adv_width </tpl>" /> px <tpl> $langOtherHigth </tpl>：<input type="text" class="txtinput_short" name="txt_heigth" size="6" id="txt_heigth" value="<tpl> $adv_array.adv_heigth </tpl>" /> px
			<label style="display:none" for="txt_width" class="wrong" metaDone="true" generated="true"></label>
			<label style="display:none" for="txt_heigth" class="wrong" metaDone="true" generated="true"></label>			</td>
		</tr>
		<tr>
			<th class="th2"><tpl> $langCSort </tpl>：</td>
			<td width="530" class="td1"><input type="text" name="txt_sort" id="txt_sort" class="txtinput_short" size="4" value="<tpl> $adv_array.adv_sort </tpl>" /><span> *<tpl> $langOtherDisGear </tpl></span>
			<label style="display:none" for="txt_sort" class="wrong" metaDone="true" generated="true"></label>			</td>
		</tr>
		<tr>
			<th class="th2"><tpl> $langOtherEstate </tpl>：</td>
			<td width="530" class="td1">
				<input name="txt_state" type="radio" value="0" <tpl> if $adv_array.adv_state eq '0' </tpl>checked="checked"<tpl> /if </tpl> /><tpl> $langCOpen </tpl>
				<input name="txt_state" type="radio" value="1" <tpl> if $adv_array.adv_state eq '1' </tpl>checked="checked"<tpl> /if </tpl> /><tpl> $langCClose </tpl>			</td>
		</tr>
		<tr>
    		<td>
		  </td>
		    <td width="530"><div>
			  <span class="btn_left"><input type="submit"  value="<tpl> $langOtherSubmit </tpl>" class="btn_submit" /></span>
			  <span class="btn_left"><input type="button" value="<tpl> $langOtherReturnList </tpl>" class="btn_submit" onclick="ShowDiv = 'result_content';getPageContent('advertisement.manage.php?action=ajax_list&curpage=<tpl>$curpage</tpl>');" /></span>
			  <input type="hidden" name="txt_id" value="<tpl> $adv_array.adv_id </tpl>" />
			 </div></td>
		</tr>
	</table>
</form>
<div id="question" style="display:none; cursor: default; padding:10px"> 
        <b style=" font-size:14px; margin-top:10px; line-height:50px; height:50px;padding-

top:10px; padding-bottom:10px"><tpl> $langOtherConfirmDel </tpl></b> <br />
        <input type="button" id="yes" value="<tpl> $langCYes </tpl>"  style=" border:1px solid 

#CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/> 
        <input type="button" id="no" value="<tpl> $langCNo </tpl>"  style="border:1px solid #CCCCCC;width:80px; 

margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/>
		<input type="hidden" id="del_value" />
</div> 
<script>
$(document).ready(function() {

	var options_add = {
		beforeSubmit:  function(){showLoading(showText);},
		success:       function(msg){
							hideLoading();
							showMessage(msg.message,msg.type);
							if(msg.type == '1'){
								ShowDiv = "result_content";
								getPageContent("advertisement.manage.php?action=ajax_list&curpage=<tpl>$curpage</tpl>");
							}
						},
		type:      'post',
		dataType:  'json'
	};
	
	$("#form_add").validate({
		errorClass: "wrong",
		rules: {
			txt_title: {required:true},
			txt_url: {required:true},
			txt_code: {required:true},
			txt_start_date: {required:true},
			txt_end_date: {required:true},
			txt_width: {number:true},
			txt_heigth: {number:true},
			txt_sort: {number:true}
		},
		messages: {
			txt_title: {required:"<tpl> $langOtherAdvTitleNotNull </tpl>"},
			txt_url: {required:"<tpl> $langOtherAdvLinkNotNull </tpl>"},
			txt_code: {required:"<tpl> $langOtherTransferCodeNotNull </tpl>"},
			txt_start_date: {required:"<tpl> $langOtherBeginTimeNotNull </tpl>"},
			txt_end_date: {required:"<tpl> $langOtherEndTimeNotNull </tpl>"},
			txt_width: {number:"<tpl> $langOtherAdvMustIsNum </tpl>"},
			txt_heigth: {number:"<tpl> $langOtherAdvMustIsNum </tpl>"},
			txt_sort: {number:"<tpl> $langOtherAdvMustIsNum </tpl>"}
		},
		submitHandler: function() {
			$('#form_add').ajaxSubmit(options_add);
		}
	});
	
	//删除图片
	var question = $('#question')[0];
	$("#delbutton").click(function(){
		$.blockUI(question, { width: '275px' });
	});
	
	$('#yes').click(function() {
			$.unblockUI();
			$.ajax({
				url: "advertisement.manage.php",
				data: 'action=del_pic&id='+<tpl> $adv_array.adv_id </tpl>,
				type:'post',
				dataType:"json",
				beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
				success: function(msg){
					hideLoading();
					showMessage(msg.message,msg.type);
					if(msg.type == 1){
						ShowDiv = "result_content";
						getPageContent("advertisement.manage.php?action=modi&id="+<tpl> $adv_array.adv_id </tpl>+"&curpage=<tpl>$curpage</tpl>");
					}
				}
			});
			return false;
		});
	$('#no').click($.unblockUI);
});	

$(function(){
   $("#s_date").datepicker();
   $("#e_date").datepicker();
})


</script>